﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Shapes;
using Resn.WhuPub.BLL;
using System.Linq;

namespace Resn.WhuPub.WPFClientUI
{
        /// <summary>
        /// StartPage.xaml 的交互逻辑
        /// </summary>
        public partial class OutsideBusinessPage : Page
        {
                private readonly GlobalManager _gm = GlobalManager.Instance;

                private readonly List<Polygon> polygons = new List<Polygon>();


                public OutsideBusinessPage()
                {
                        InitializeComponent();
                }

                private void Page_Loaded(object sender, RoutedEventArgs e)
                {
                        
                        LayoutRoot.DataContext = _gm;
                }

                private void CorporateButton_Click(object sender, RoutedEventArgs e)
                {
                        _gm.Corporates = new ObservableCollection<Corporate>( _gm.LoginEmployee.Corporates);
                        NavigationService.Navigate(new Uri("ManageCorporatesPage.xaml", UriKind.Relative));
                }

                private void BranchButton_Click(object sender, RoutedEventArgs e)
                {
                        _gm.Branchs = new ObservableCollection<Branch>(_gm.LoginEmployee.Branchs);
                        NavigationService.Navigate(new Uri("ManageBranchsPage.xaml", UriKind.Relative));
                }

                private void DepartmentButton_Click(object sender, RoutedEventArgs e)
                {
                        _gm.Departments = new ObservableCollection<Department>(_gm.LoginEmployee.Departments);
                        NavigationService.Navigate(new Uri("ManageDepartmentsPage.xaml", UriKind.Relative));
                }

                private void ContactButton_Click(object sender, RoutedEventArgs e)
                {
                        _gm.Contacts = new ObservableCollection<Contact>(_gm.LoginEmployee.Contacts);
                        NavigationService.Navigate(new Uri("ManageContactsPage.xaml", UriKind.Relative));
                }

                private void BookButton_Click(object sender, RoutedEventArgs e)
                {
                        _gm.Books = new ObservableCollection<Book>(_gm.BookEntityManager.Entitys);
                        NavigationService.Navigate(new Uri("ManageBooksPage.xaml", UriKind.Relative));
                }
        }
}